var HumidityAvgs = {

    html: function (HumidityAvgs) {

        var html="<div class=\"HumidityAvgsDiv\" id='HumidityAvgsDiv'>";
        var zhibiaoSelectHtml="";
        if(HumidityAvgs!=null&&typeof(HumidityAvgs)!='underfined'&&HumidityAvgs.length>0){
            zhibiaoSelectHtml="<div class=\"pluginsSingleRows layui-form-item \"><label class='layui-form-label'>层次平均:</label><div class='layui-input-block'><select id='zhibiaoSelect' lay-filter=\"search_type\" >";
        }else{
            zhibiaoSelectHtml="<div class=\"pluginsSingleRows layui-form-item \" style=\"display:none;\"><label class='layui-form-label'>层次平均:</label><div class='layui-input-block'><select lay-filter=\"search_type\" id='zhibiaoSelect'>";
        }

            for(var i=0;i<HumidityAvgs.length;i++){
                zhibiaoSelectHtml+="<option value='"+(i+1)+"' ";
                if(i==0){
                    zhibiaoSelectHtml+="selected=\"selected\"";
                }
                zhibiaoSelectHtml+=" >"+HumidityAvgs[i]+"</option>";
            }


        zhibiaoSelectHtml+="</select></div></div><input id='test' value='10-100' style='display: none;'/>";
        html+=zhibiaoSelectHtml;

        html+="</div>";
        return html;
    },

    getData: function () {
        var val=$('#HumidityAvgsDiv option:selected') .val();
        if(val !=null && val !="underfined"){
            Global.postData.paramsMap = $('#HumidityAvgsDiv option:selected') .val();
            if(val=="6"){
                Global.postData.paramsMap =  $('#test').val();
            }
        }

    },

    renderCallback: function () {
        var form = layui.form, layer = layui.layer;
        form.on('select(search_type)', function(data){
        if(data.value=="6"){
            layLayer.open({
                type: 1,
                title: '层次平均设置',
                area: '300px',
                btn: ['确定', '重置'],
                btnAlign: 'c',
                content: '<div class="index-setting-layer">'+
                '<span class="name"> '+ "最小值" +' </span> : ' +
                '<input id="min" step="10" style="width:25%" min="0" class="min layui-input layui-input-inline" value="'+ 0 +'" type="number">---'+
                ' <span class="name"> '+ "最大值" +' </span> : ' +
                '<input id="max" step="10" style="width:25%" max="100" class="max layui-input layui-input-inline" value="'+ 100 +'" type="number">' +
                '</div>',

                /*yes是按钮一的回调，第二个按钮是btn2*/
                yes: function (ind) {
                    /*修改赋值给postdata*/
                    var minval=$('#min') .val();
                    if(minval=="0"){
                        minval="10";
                    }
                    $('#test').val(minval+"-"+$('#max') .val());
                    layLayer.close(ind);
                },
                /*重置*/
                btn2: function () {
                    var minval=$('#min') .val("0")
                    var maxval=$('#max') .val("100")
                    return false;     //禁止点击该按钮关闭
                }
            })
        }
        })
    }

};
  
  
  